import { renderView } from '@/workers/excelTempWorker.js'
import { defineIngredientListRFn, setData } from '@/promises/model/modelWorkerFn.js'

export const useModelPromise = () => {

  const getModelTSPromise = (newSheet, data) => {
    return new Promise((resolve) => {
      renderView(newSheet, data, [defineIngredientListRFn, setData]).then(() => {
        resolve()
      })
    })
  }

  return {
    getModelTSPromise
  }
}


// const d = {
//   'name': 'Tater',
//   'bold': () => {
//     return (text, render) => {
//       return '<b>' + render(text) + '</b>'
//     }
//   }
// }
// const t = '{{#bold}}Hi {{name}}.{{/bold}}'
// const result = Mustache.render(t, d)
// console.log(result)